<?php
class Component_newslettersignup_register extends appRain_Base_Component
{
    public function init()
    {

        App::Module('Hook')->setHookName('UI')
                           ->setAction("newslettersignup_placeholder")
                           ->Register(get_class($this),"add_html");

		App::Module('Hook')->setHookName('InterfaceBuilder')
                           ->setAction("update_definition")
                           ->Register(get_class($this),"interfacebuilder_update_definition");

		App::Module('Hook')->setHookName('InformationSet')
                           ->setAction("register_definition")
                           ->Register(get_class($this),"register_informationset_defination");

		App::Module('Hook')->setHookName('Controller')
                           ->setAction("register_controller")
                           ->Register(get_class($this),"register_controller");


    }

    public function init_on_install(){}

    public function init_on_uninstall(){}

    
    public function add_html($send)
    {
		return App::Helper('Utility')->callElementByPath($this->attachMyPath('elements/markup.phtml'));
    }

	public function interfacebuilder_update_definition($send)
    {
        if(isset($send['component']['child']))
        {
            $send['component']['child'][] = Array("title"=>"News Letter Signup",
												"items"=>Array(array("title"=>"View List","link"=>"/information/manage/nsemaillist")));
            return $send;
        }
    }

	public function register_informationset_defination()
    {
        $srcpaths = Array();
        $srcpaths[] =   array('type'=>'nsemaillist',
                               'path'=>$this->attachMyPath('information_set/nsemaillist.xml'));
        return $srcpaths;
    }

	public function register_controller()
    {
        $srcpaths = Array();
        $srcpaths[] =   array('name'=>'Newslettersignup',
                              'controller_path'=>$this->attachMyPath('controllers'));
        return $srcpaths;
    }
}